﻿<UserControl x:Class="UserPermission.View.UserPermissionView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"  
             xmlns:commad="clr-namespace:Infrastructure.Commands;assembly=Infrastructure"
             xmlns:primitives="clr-namespace:Telerik.Windows.Controls.Primitives;assembly=Telerik.Windows.Controls" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <DataTemplate x:Key="ComboBoxSimpleTemplate">
            <Grid>
                <TextBlock Text="{Binding UserName}" />
            </Grid>
        </DataTemplate>
    </UserControl.Resources>
    <Grid Margin="5">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0 8 0 0">
            <TextBlock Text="用户名:" Width="60"></TextBlock>
            <telerik:RadComboBox x:Name="UserName" ItemsSource="{Binding UserNames}" SelectedItem="{Binding SelectedUserName}" IsEditable="True" 
                                 Text="{Binding EditedUserName}" telerik:TextSearch.TextPath="UserName"
                                 commad:ComboBoxLostFocusCommand.Command="{Binding ComboBoxLostFocus}"
                                 ItemTemplate="{StaticResource ComboBoxSimpleTemplate}" Width="180"></telerik:RadComboBox>
        </StackPanel>
        <StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0 8 0 0">
            <TextBlock Text="密码:" Width="60"></TextBlock>
            <TextBox Text="{Binding Password,UpdateSourceTrigger=PropertyChanged}" Width="180"></TextBox>
        </StackPanel>
        <StackPanel Grid.Row="2" Orientation="Horizontal" Margin="0 8 0 0">
            <TextBlock Text="确认密码:" Width="60"></TextBlock>
            <TextBox Text="{Binding ConfirmedPassword,UpdateSourceTrigger=PropertyChanged}" Width="180"></TextBox>
        </StackPanel>
        <StackPanel Grid.Row="3" Orientation="Horizontal" Margin="0 8 0 0">
            <TextBlock Text="权限:" Width="60"></TextBlock>
            <primitives:RadUniformGrid Columns="2">
                <CheckBox Content="生产指示文档上传" Margin="3" IsChecked="{Binding CanUploadImages}" ></CheckBox>
                <CheckBox Content="生产指示文档管理" Margin="3" IsChecked="{Binding CanManageImages}" ></CheckBox>
                <CheckBox Content="机种生产指示信息录入" Margin="3" IsChecked="{Binding CanUploadInfo}" ></CheckBox>
                <CheckBox Content="机种生产指示信息管理" Margin="3" IsChecked="{Binding CanManageInfo}" ></CheckBox>
                <CheckBox Content="机种生产指示信息显示" Margin="3" IsChecked="{Binding CanPlayInfo}" ></CheckBox>
                <CheckBox Content="用户权限管理" Margin="3" IsChecked="{Binding CanManageUser}" ></CheckBox>
                <CheckBox Content="系统参数设置" Margin="3" IsChecked="{Binding CanManageSysParam}" ></CheckBox>
            </primitives:RadUniformGrid>
        </StackPanel>
        <StackPanel Orientation="Horizontal" Grid.Row="4" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0 8 0 0">
            <telerik:RadButton Width="80" Height="22" Content="确定" Margin="0 0 5 0" Command="{Binding SaveCommand,Mode=TwoWay}"></telerik:RadButton>
            <telerik:RadButton Width="80" Height="22" Content="删除" Margin="5 0 0 0" Command="{Binding DeleteClick,Mode=TwoWay}"></telerik:RadButton>
        </StackPanel>
    </Grid>
</UserControl>
